package com.sulj.domain;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * 订单类
 *
 * @author slj
 * @date 2025-03-29
 */
public class Order implements Serializable {


    /**
     * 顾客姓名
     */
    private String customerName;

    /**
     * 订单总价
     */
    private BigDecimal totalAmount;

    /**
     * 购物条目列表
     */
    private List<CartItem> items = new ArrayList<>();

    /**
     * 优惠券
     */
    private Coupon coupon;

    /**
     * 添加购买的水果
     *
     * @param fruit    水果
     * @param quantity 数量
     */
    public void addItem(Fruit fruit, int quantity) {
        items.add(new CartItem(fruit, quantity));
    }

    public Coupon getCoupon() {
        return coupon;
    }

    public void setCoupon(Coupon coupon) {
        this.coupon = coupon;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    public List<CartItem> getItems() {
        return items;
    }

}
